import React from 'react'
import { Outlet, useNavigate } from 'react-router-dom'
export default function Home() {
  const Navigate = useNavigate()
  //当点击按钮的时候跳转对应的路由页面
  //编程式路由
  const changeMusic = () => {

    Navigate('/main/home/music/?user=小黑子&id=001')
  }
  const changeNews = () => {

    Navigate('/main/home/news/?user=大黑子&id=002')
  }
  return (
    <div>
      <p>Home</p>
      <button onClick={changeMusic}>Music</button>
      <button onClick={changeNews}>News</button>
      {/* 子组件插入的地方 */}
      <Outlet />
    </div>

  )
}
